import DisplayObjectModel from "./DisplayObjectModel"

export default class LayerModel {
    name=''
    children:DisplayObjectModel[]=[]
    static create(data:string|any):LayerModel{
        let json:any
        if(typeof data === 'string'){
            json=JSON.parse(data)
        }else{
            json=data
        }
        const model=new LayerModel()
        model.name=json.name
        model.children=json.children.map(item=>DisplayObjectModel.create(item))
        return model
    }
}